home *** CD-ROM | disk | FTP | other *** search
- Path: roger.ecn.purdue.edu!jonesbr
- From: jonesbr@roger.ecn.purdue.edu (Brian R. Jones)
- Newsgroups: comp.lang.c
- Subject: Converting numbers to strings?
- Date: 24 Mar 1996 20:15:22 GMT
- Organization: Purdue University, W. Lafayette, IN
- Message-ID: <4j4agq$85h@mozo.cc.purdue.edu>
- NNTP-Posting-Host: roger.ecn.purdue.edu
-
- I am pretty familiar with the functions that convert strings into
- numbers, but am totally unfamiliar with the reverse process. What
- I am looking to do is have a program save several files with the
- same basic file root, but differentiated by a number. For example
- I have a loop in my code that varies a variable, q, that varies in
- increments of 100. Each time through the loop, I would like to save
- a data file called:
-
- out1q100.dat
- out1q200.dat
- out1q300.dat
- etc.
-
- It seems that if I can simply convert the floating point variable, q,
- to a string, I could use strcat to add it to the basic filename root,
- out1q. Is there a simple way to do this? I haven't found anything
- in the string(s).h file that would do the trick. Many thanks!
-
- -Brian
-
- P.S. I am running Solaris 5.3 on a Sun workstation if it makes a
- difference.
-